package com.net.xpay.common.manager.impl.notification;

import com.google.common.base.Preconditions;
import com.net.common.dao.BasicMapper;
import com.net.xpay.common.dao.notification.NotificationMapper;
import com.net.xpay.common.domain.notification.Notification;
import com.net.xpay.common.enums.notification.NotificationModule;
import com.net.xpay.common.enums.notification.NotificationStatus;
import com.net.xpay.common.manager.notification.NotificationManager;
import com.net.common.manager.AbstractManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class NotificationManagerImpl extends AbstractManager<Notification> implements NotificationManager{

    @Autowired
    private NotificationMapper mapper;


    @Override
    protected BasicMapper<Long, Notification> getMapper() {
        return mapper;
    }

    @Override
    public Notification findLastByModuleWithStatus(NotificationModule module, NotificationStatus status) {
        Preconditions.checkArgument(module != null && status != null);
        return mapper.findLastByModuleWithStatus(module, status);
    }
}
